#include "webpage.h"
#include "qdebug.h"

WebPage::WebPage(QObject *parent): QWebPage(parent) {
//	this->settings()->setAttribute(QWebSettings::JavascriptEnabled, false);
	this->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, false);
	this->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
	this->settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true);
	this->settings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true);
	this->settings()->setAttribute(QWebSettings::LocalContentCanAccessFileUrls, true);
	this->settings()->setAttribute(QWebSettings::AcceleratedCompositingEnabled, true);
	this->settings()->setAttribute(QWebSettings::PluginsEnabled, false);
	this->settings()->setAttribute(QWebSettings::SiteSpecificQuirksEnabled, false);
}

bool WebPage::shouldInterruptJavaScript() {
	return false;
}

WebPage *WebPage::createWindow(WebWindowType type) {
	return this->createWindow();
}

void WebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) {
	qDebug() << message;
}
